package com.carepad.action.weekdata;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.carepad.action.AbstractManagementAction;
import com.carepad.service.ChartDataService;
import com.carepad.service.RecordsService;
import com.carepad.util.DateConverterEnJa;

public abstract class AbstractWeekDataAction extends AbstractManagementAction {

	private static final long serialVersionUID = 1L;

	@Qualifier("recordsService")
	@Autowired
	protected RecordsService recordsService;
	
	@Qualifier("chartDataService")
	@Autowired
	protected ChartDataService chartDataService;

	@SuppressWarnings("deprecation")
	public List<String> getJaWeekDaysList(Date startDate, Date lastDate){
		
		List<String> weekDaysList = new ArrayList<String>();
		Date tempDate;
		
		for(int i = 0; i < 7; i++) {
			
			tempDate = new Date(startDate.getYear(), startDate.getMonth(),
					startDate.getDate() + i);
			
			String data = DateConverterEnJa.EnDatetoJaShort(tempDate);
			
			weekDaysList.add(data);
		}
		
		return weekDaysList;
		
	}
	
	@SuppressWarnings("deprecation")
	public List<Date> getEnWeekDaysList(Date startDate, Date lastDate){
		
		List<Date> weekDaysList = new ArrayList<Date>();
		Date tempDate;
		
		for(int i = 0; i < 7; i++) {
			
			tempDate = new Date(startDate.getYear(), startDate.getMonth(),
					startDate.getDate() + i);
			
			weekDaysList.add(tempDate);
		}
		
		return weekDaysList;
		
	}
}
